A Primer on Quantum Computing by Franklin de Lima Marquezino & Renato Portugal & Carlile Lavor

A Primer on Quantum Computing by Franklin de Lima Marquezino & Renato Portugal & Carlile Lavor

Author:Franklin de Lima Marquezino & Renato Portugal & Carlile Lavor
Language: eng
Format: epub
ISBN: 9783030190668
Publisher: Springer International Publishing


3.6 Computational Simulations

Grover’s algorithm can be easily simulated by a Python script. It is convenient to import the NumPy library for numerical processing. We should also import matplotlib if we wish to plot the results. We can do that by the following commands:

(3.51)

Now, we define the size of the input list and the searched element, simply by initializing some variables:

(3.52)

For simplicity, we assume in the commands above that the size of the list is N = 2n and the searched element m is in the middle of the list.

Now, we define the oracle operator and the inversion about the mean. Although Python has native support to complex numbers, they are not necessary here and we can assume that all the matrices have floating point entries.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.